From: Aleksey Kladov Date: Mon, 2 Apr 2018 20:55:57 +0000 (+0300) Subject: Rename TargetFileType -> FileFlavor X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~1^2~106^2~2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=7a9f59cac568c5ec9149a9727cd3a7a43efcce56;p=cargo.git Rename TargetFileType -> FileFlavor --- diff --git a/src/cargo/ops/cargo_rustc/context/compilation_files.rs b/src/cargo/ops/cargo_rustc/context/compilation_files.rs index b1cfa97c6..752b07cf6 100644 --- a/src/cargo/ops/cargo_rustc/context/compilation_files.rs +++ b/src/cargo/ops/cargo_rustc/context/compilation_files.rs @@ -9,7 +9,7 @@ use lazycell::LazyCell; use core::{TargetKind, Workspace}; use ops::cargo_rustc::layout::Layout; -use ops::cargo_rustc::TargetFileType; +use ops::cargo_rustc::FileFlavor; use ops::{Context, Kind, Unit}; use util::{self, CargoResult}; @@ -35,7 +35,7 @@ pub struct CompilationFiles<'a, 'cfg: 'a> { /// - If it should be linked into `target`, and what it should be called (e.g. without /// metadata). /// - Type of the file (library / debug symbol / else) - outputs: HashMap, LazyCell, TargetFileType)>>>>, + outputs: HashMap, LazyCell, FileFlavor)>>>>, } impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { @@ -157,7 +157,7 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { &self, unit: &Unit<'a>, cx: &Context<'a, 'cfg>, - ) -> CargoResult, TargetFileType)>>> { + ) -> CargoResult, FileFlavor)>>> { self.outputs[unit] .try_borrow_with(|| self.calc_target_filenames(unit, cx)) .map(Arc::clone) @@ -215,7 +215,7 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { &self, unit: &Unit<'a>, cx: &Context<'a, 'cfg>, - ) -> CargoResult, TargetFileType)>>> { + ) -> CargoResult, FileFlavor)>>> { let out_dir = self.out_dir(unit); let file_stem = self.file_stem(unit); let link_stem = self.link_stem(unit); @@ -233,9 +233,9 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { let link_dst = link_stem .clone() .map(|(ld, ls)| ld.join(format!("lib{}.rmeta", ls))); - ret.push((filename, link_dst, TargetFileType::Linkable)); + ret.push((filename, link_dst, FileFlavor::Linkable)); } else { - let mut add = |crate_type: &str, file_type: TargetFileType| -> CargoResult<()> { + let mut add = |crate_type: &str, file_type: FileFlavor| -> CargoResult<()> { let crate_type = if crate_type == "lib" { "rlib" } else { @@ -277,7 +277,7 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { file_type.suffix )) }); - ret.push((filename, link_dst, file_type.target_file_type)); + ret.push((filename, link_dst, file_type.flavor)); } } // not supported, don't worry about it @@ -294,19 +294,19 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { | TargetKind::ExampleBin | TargetKind::Bench | TargetKind::Test => { - add("bin", TargetFileType::Normal)?; + add("bin", FileFlavor::Normal)?; } TargetKind::Lib(..) | TargetKind::ExampleLib(..) if unit.profile.test => { - add("bin", TargetFileType::Normal)?; + add("bin", FileFlavor::Normal)?; } TargetKind::ExampleLib(ref kinds) | TargetKind::Lib(ref kinds) => { for kind in kinds { add( kind.crate_type(), if kind.linkable() { - TargetFileType::Linkable + FileFlavor::Linkable } else { - TargetFileType::Normal + FileFlavor::Normal }, )?; } diff --git a/src/cargo/ops/cargo_rustc/context/mod.rs b/src/cargo/ops/cargo_rustc/context/mod.rs index 36857b1a7..5993c9225 100644 --- a/src/cargo/ops/cargo_rustc/context/mod.rs +++ b/src/cargo/ops/cargo_rustc/context/mod.rs @@ -28,7 +28,7 @@ use self::compilation_files::CompilationFiles; pub use self::compilation_files::Metadata; mod target_info; -pub use self::target_info::TargetFileType; +pub use self::target_info::FileFlavor; use self::target_info::TargetInfo; /// All information needed to define a Unit. @@ -277,7 +277,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { pub fn target_filenames( &mut self, unit: &Unit<'a>, - ) -> CargoResult, TargetFileType)>>> { + ) -> CargoResult, FileFlavor)>>> { self.files.as_ref().unwrap().target_filenames(unit, self) } diff --git a/src/cargo/ops/cargo_rustc/context/target_info.rs b/src/cargo/ops/cargo_rustc/context/target_info.rs index 1514ab28f..6dbb3076b 100644 --- a/src/cargo/ops/cargo_rustc/context/target_info.rs +++ b/src/cargo/ops/cargo_rustc/context/target_info.rs @@ -18,7 +18,7 @@ pub struct TargetInfo { /// Type of each file generated by a Unit. #[derive(Copy, Clone, PartialEq, Eq, Debug)] -pub enum TargetFileType { +pub enum FileFlavor { /// Not a special file type. Normal, /// It is something you can link against (e.g. a library) @@ -30,7 +30,7 @@ pub enum TargetFileType { pub struct FileType { pub suffix: String, pub prefix: String, - pub target_file_type: TargetFileType, + pub flavor: FileFlavor, pub should_replace_hyphens: bool, } @@ -126,7 +126,7 @@ impl TargetInfo { pub fn file_types( &self, crate_type: &str, - file_type: TargetFileType, + file_type: FileFlavor, kind: &TargetKind, target_triple: &str, ) -> CargoResult>> { @@ -147,7 +147,7 @@ impl TargetInfo { FileType { suffix: suffix.to_string(), prefix: prefix.clone(), - target_file_type: file_type, + flavor: file_type, should_replace_hyphens: false, }, ]; @@ -159,7 +159,7 @@ impl TargetInfo { ret.push(FileType { suffix: ".dll.lib".to_string(), prefix: prefix.clone(), - target_file_type: TargetFileType::Normal, + flavor: FileFlavor::Normal, should_replace_hyphens: false, }) } @@ -169,7 +169,7 @@ impl TargetInfo { ret.push(FileType { suffix: ".wasm".to_string(), prefix: prefix.clone(), - target_file_type: TargetFileType::Normal, + flavor: FileFlavor::Normal, should_replace_hyphens: true, }) } @@ -184,14 +184,14 @@ impl TargetInfo { ret.push(FileType { suffix: ".dSYM".to_string(), prefix: prefix.clone(), - target_file_type: TargetFileType::DebugInfo, + flavor: FileFlavor::DebugInfo, should_replace_hyphens: false, }) } else if target_triple.ends_with("-msvc") { ret.push(FileType { suffix: ".pdb".to_string(), prefix: prefix.clone(), - target_file_type: TargetFileType::DebugInfo, + flavor: FileFlavor::DebugInfo, should_replace_hyphens: false, }) } diff --git a/src/cargo/ops/cargo_rustc/fingerprint.rs b/src/cargo/ops/cargo_rustc/fingerprint.rs index 74deda193..0c55df23f 100644 --- a/src/cargo/ops/cargo_rustc/fingerprint.rs +++ b/src/cargo/ops/cargo_rustc/fingerprint.rs @@ -16,7 +16,7 @@ use util::errors::{CargoResult, CargoResultExt}; use util::paths; use super::job::Work; -use super::context::{Context, TargetFileType, Unit}; +use super::context::{Context, FileFlavor, Unit}; use super::custom_build::BuildDeps; /// A tuple result of the `prepare_foo` functions in this module. @@ -92,7 +92,7 @@ pub fn prepare_target<'a, 'cfg>( .exists(); } else { for &(ref src, ref link_dst, file_type) in cx.target_filenames(unit)?.iter() { - if file_type == TargetFileType::DebugInfo { + if file_type == FileFlavor::DebugInfo { continue; } missing_outputs |= !src.exists(); diff --git a/src/cargo/ops/cargo_rustc/mod.rs b/src/cargo/ops/cargo_rustc/mod.rs index 0007ac15b..76b9d9afd 100644 --- a/src/cargo/ops/cargo_rustc/mod.rs +++ b/src/cargo/ops/cargo_rustc/mod.rs @@ -25,7 +25,7 @@ use self::job_queue::JobQueue; use self::output_depinfo::output_depinfo; pub use self::compilation::Compilation; -pub use self::context::{Context, TargetFileType, Unit}; +pub use self::context::{Context, FileFlavor, Unit}; pub use self::custom_build::{BuildMap, BuildOutput, BuildScripts}; pub use self::layout::is_bad_artifact_name; @@ -194,7 +194,7 @@ pub fn compile_targets<'a, 'cfg: 'a>( for unit in units.iter() { for &(ref dst, ref link_dst, file_type) in cx.target_filenames(unit)?.iter() { - if file_type == TargetFileType::DebugInfo { + if file_type == FileFlavor::DebugInfo { continue; } @@ -1072,7 +1072,7 @@ fn build_deps_args<'a, 'cfg>( dep: &Unit<'a>, ) -> CargoResult<()> { for &(ref dst, _, file_type) in cx.target_filenames(dep)?.iter() { - if file_type != TargetFileType::Linkable { + if file_type != FileFlavor::Linkable { continue; } let mut v = OsString::new();